package study.apm.arthas.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.atomic.AtomicBoolean;

@Slf4j
@RestController
@RequestMapping("/thread")
public class ThreadController {

    public AtomicBoolean running = new AtomicBoolean(true);

    @RequestMapping("/start")
    public void start() {
        while (running.get()) {
            int a = 1, b = 2;
            int c = a + 1;
            int d = b + 2;
            log.info(">>>>>> {}, {}", c, d);
        }
    }

    @RequestMapping("/stop")
    public void stop() {
        running.set(false);
    }
}
